package cn.hiapi.core.basic.redis;

import cn.hiapi.core.basic.redis.serializer.FastJson2JsonRedisSerializer;
import cn.hiapi.core.basic.redis.service.impl.RedisServiceImpl;
import com.alibaba.fastjson2.JSONWriter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * @author AdinZ
 * @date 2020/11/7 14:05
 */
//@Configuration
public class RedisConfig {
//    @Bean
    public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory factory) {
        FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class);
        RedisTemplate<Object, Object> template = new RedisTemplate<>();
        template.setDefaultSerializer(serializer);
        return template;
    }

}
